package com.guangzhi.weijianzhi.maincenter;

import java.util.ArrayList;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.ViewPager;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.guangzhi.weijianzhi.R;
import com.guangzhi.weijianzhi.classify.demo1;
import com.guangzhi.weijianzhi.classify.demo2;
import com.guangzhi.weijianzhi.fragment.BaseFragment;

public class UserCenterFragment extends BaseFragment{
	private ArrayList<Fragment> lis = new ArrayList<Fragment>();
	@Override
	public void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		demo1 d =new demo1();
		demo2 d2 = new demo2();
		lis.add(d);
		lis.add(d2);
	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		// TODO Auto-generated method stub
	  View inflate = View.inflate(getActivity(), R.layout.sss, null);
		ViewPager pager = (ViewPager) inflate.findViewById(R.id.pager);
		pager.setAdapter(new MyAdapter(getFragmentManager()));
		return inflate;
	}
	
	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onActivityCreated(savedInstanceState);
	}
	
	
	private class MyAdapter extends FragmentPagerAdapter{
		public MyAdapter(FragmentManager fm) {
			super(fm);
			// TODO Auto-generated constructor stub
		}

		@Override
		public Fragment getItem(int arg0) {
			// TODO Auto-generated method stub
			return lis.get(arg0);
		}

		@Override
		public int getCount() {
			// TODO Auto-generated method stub
			return lis.size();
		}
	}
	
}
